// 抽象接口
class IService {
public:
    virtual void execute() = 0;
};

// 具体实现
class ConcreteService : public IService {
public:
    void execute() override {
        // 实现具体逻辑
    }
};

// 客户端类
class Client {
private:
    IService* service;

public:
    // 通过构造函数注入依赖
    Client(IService* svc) : service(svc) {}

    void doSomething() {
        service->execute();
    }
};

int main() {
    ConcreteService service;
    Client client(&service);
    client.doSomething();

    return 0;
}